package com.ybxx.base.dao.impl;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import org.springframework.dao.DataAccessException;
import org.springframework.jdbc.core.StatementCallback;

import com.ybxx.base.dao.RoomDao;
import com.ybxx.base.model.Room;
import com.ybxx.core.command.QueryFilter;
import com.ybxx.core.dao.impl.BaseDaoImpl;
import com.ybxx.core.web.paging.PagingBean;

public class RoomDaoImpl extends BaseDaoImpl<Room> implements RoomDao {

	public RoomDaoImpl() {
		super(Room.class);
		// TODO Auto-generated constructor stub
	}
	/*为打印通知单，查询相应单元下的房屋编号*/
	public List<Room> queryRoomRid(final String sql){
		return super.jdbcTemplate.execute(new StatementCallback<List<Room>>(){

			public List<Room> doInStatement(Statement state)
					throws SQLException, DataAccessException {
				List<Room> rooms=new ArrayList<Room>();
				ResultSet rs=state.executeQuery(sql);
				while(rs.next()){
					Room room=new Room();
					room.setRid(rs.getString("rid"));
					rooms.add(room);
				}
				return rooms;
			}});
	}
}
